% Optimal reserve given v0, bidder paramters, and fees
% PAR.meandiffQ = 0 if PAR.sellerqualitysep=0 but
% =mean(Quality_bidder-Quality_seller in posr listings) otherwise
% Homogenized auction - at g(Z)=0 
% ---------------------------------------------- %
function[reserve]  = optreserve(u0,cS,cB,PDFb,CDFb,PAR)
    
        if cS < 1
            rfunc   = @(r) ((r- exp(u0)/(1-cS) - (1-CDFb(log(r*(1+cB))-PAR.meandiffQ))/((1+cB)*PDFb(log(r*(1+cB))-PAR.meandiffQ)) ).^2);
            reserve = fminbnd(rfunc,exp(PAR.minv),exp(PAR.maxv));
        else
            reserve = exp(PAR.maxv);
        end
    
end